/*
 * Error404.java
 * 
 * This file is part of Netuno Proteu.
 * 
 * CajuScript is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3, or (at your option) 
 * any later version.
 * 
 * CajuScript is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with CajuScript.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.netuno.proteu;

/**
 * Page of the HTTP Erro 404
 * @author eduveks
 */
public class Error404 {
    /**
     * Page Constructor
     * @param proteu Proteu
     */
    public Error404(Proteu proteu) throws java.io.IOException {
        if (Config.getError404().equals("")) {
        	proteu.getOutput().println("<html>");
        	proteu.getOutput().println("<head>");
        	proteu.getOutput().println("  <title>404 Not Found</title>");
        	proteu.getOutput().println("</head>");
        	proteu.getOutput().println("<body>");
        	proteu.getOutput().println("  <h2>Not Found</h2><p>The requested URL <b>"+ proteu.getRequestHead().getString("Url") +"</b> was not found on this server.</p>");
        	proteu.getOutput().println("</body>");
        	proteu.getOutput().println("</html>");
        } else {
        	proteu.redirect(Config.getError404());
        }
    }
}
